The following example shows how to apply the effect. DropShadow-example.qml example
*/ Item id: rootItem
/*! This property defines the source item that is going to be used as the source for the generated shadow.
It is not supported to let the effect include itself, for instance by setting source to the effect's parent. */ property variant source
/*! Radius defines the softness of the shadow. A larger radius causes the edges of the shadow to appear more blurry.
Depending on the radius value, value of the łDropShadow::samplessamples should be set to sufficiently large to ensure the visual quality.
The value ranges from 0.0 (no blur) to inf. By default, the property is set to 0̧0.0 (no blur).
Output examples with different radius values DropShadow_radius1.png DropShadow_radius2.png DropShadow_radius3.png ṟ adius: 0 ṟ adius: 6 ṟ adius: 12 łsamples: 24 łsamples: 24 łsamples: 24 łcolor: #000000 łcolor: #000000 łcolor: #000000 łhorizontalOffset: 0 łhorizontalOffset: 0 łhorizontalOffset: 0 łverticalOffset: 20 łverticalOffset: 20 łverticalOffset: 20 łspread: 0 łspread: 0 łspread: 0
*/ property real radius: 0.0
/*! This property defines how many samples are taken per pixel when edge softening blur calculation is done. Larger value produces better quality, but is slower to render.
Ideally, this value should be twice as large as the highest required radius value, for example, if the radius is animated between 0.0 and 4.0, samples should be set to 8.
The value ranges from 0 to 32. By default, the property is set to 0̧0.
This property is not intended to be animated. Changing this property may cause the underlying OpenGL shaders to be recompiled.
When łDropShadow::fastfast property is set to true, this property has no effect.
*/ property int samples: 0
/*! This property defines the RGBA color value which is used for the shadow.
By default, the property is set to ;̧"black".
Output examples with different color values DropShadow_color1.png DropShadow_color2.png DropShadow_color3.png c̱ olor: #000000 c̱ olor: #0000ff c̱ olor: #aa000000 łradius: 8 łradius: 8 łradius: 8 łsamples: 16 łsamples: 16 łsamples: 16 łhorizontalOffset: 0 łhorizontalOffset: 0 łhorizontalOffset: 0 łverticalOffset: 20 łverticalOffset: 20 łverticalOffset: 20 łspread: 0 łspread: 0 łspread: 0
*/ property color color: "black"
/*! real QtGraphicalEffects1::DropShadow::horizontalOffset real QtGraphicalEffects1::DropShadow::verticalOffset
HorizontalOffset and verticalOffset properties define the offset for the rendered shadow compared to the DropShadow item position. Often, the DropShadow item is anchored so that it fills the source element. In this case, if the HorizontalOffset and verticalOffset properties are set to 0, the shadow is rendered exactly under the source item. By changing the offset properties, the shadow can be positioned relatively to the source item.
The values range from -inf to inf. By default, the properties are set to 0̧0.
Output examples with different horizontalOffset values DropShadow_horizontalOffset1.png DropShadow_horizontalOffset2.png DropShadow_horizontalOffset3.png ẖ orizontalOffset: -20 ẖ orizontalOffset: 0 ẖ orizontalOffset: 20 łradius: 4 łradius: 4 łradius: 4 łsamples: 8 łsamples: 8 łsamples: 8 łcolor: #000000 łcolor: #000000 łcolor: #000000 łverticalOffset: 0 łverticalOffset: 0 łverticalOffset: 0 łspread: 0 łspread: 0 łspread: 0
*/ property real horizontalOffset: 0.0 property real verticalOffset: 0.0
/*! This property defines how large part of the shadow color is strenghtened near the source edges.
The value ranges from 0.0 to 1.0. By default, the property is set to 0̧.5.
Output examples with different spread values DropShadow_spread1.png DropShadow_spread2.png DropShadow_spread3.png s̱ pread: 0.0 s̱ pread: 0.5 s̱ pread: 1.0 łradius: 8 łradius: 8 łradius: 8 łsamples: 16 łsamples: 16 łsamples: 16 łcolor: #000000 łcolor: #000000 łcolor: #000000 łhorizontalOffset: 0 łhorizontalOffset: 0 łhorizontalOffset: 0 łverticalOffset: 20 łverticalOffset: 20 łverticalOffset: 20
*/ property real spread: 0.0
/*! This property selects the blurring algorithm that is used to produce the softness for the effect. Setting this to true enables fast algorithm, setting value to false produces higher quality result.
By default, the property is set to f̧alse.
Output examples with different fast values DropShadow_fast1.png DropShadow_fast2.png f̱ ast: false f̱ ast: true łradius: 16 łradius: 16 łsamples: 24 łsamples: 24 łcolor: #000000 łcolor: #000000 łhorizontalOffset: 0 łhorizontalOffset: 0 łverticalOffset: 20 łverticalOffset: 20 łspread: 0 łspread: 0
*/ property bool fast: false
/*! This property allows the effect output pixels to be cached in order to improve the rendering performance. Every time the source or effect properties are changed, the pixels in the cache must be updated. Memory consumption is increased, because an extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect properties are animated.
By default, the property is set to f̧alse.
*/ property bool cached: false
property bool transparentBorder: false
Loader x: rootItem.horizontalOffset y: rootItem.verticalOffset width: parent.width height: parent.height sourceComponent: rootItem.fast ? fastGlow : gaussianGlow
Component id: gaussianGlow GaussianGlow anchors.fill: parent source: sourceProxy.output radius: rootItem.radius maximumRadius: rootItem.samples * 0.5 color: rootItem.color cached: rootItem.cached spread: rootItem.spread transparentBorder: rootItem.transparentBorder
Component id: fastGlow FastGlow anchors.fill: parent source: sourceProxy.output blur: Math.pow(rootItem.radius / 64.0, 0.4) color: rootItem.color cached: rootItem.cached spread: rootItem.spread transparentBorder: rootItem.transparentBorder
SourceProxy id: sourceProxy input: rootItem.source sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) ShaderEffect anchors.fill: parent property variant source: sourceProxy.output